/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.miracleteam.miracle.dao.daoImpl;

import com.miracleteam.miracle.dao.NhanVienCuaGianHangDAO;
import com.miracleteam.miracle.utils.HibernateUtil;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.Session;


/**
 *
 * @author DangKhoa
 */
public class NhanVienCuaGianHangDAOImpl implements NhanVienCuaGianHangDAO{
     Logger logger=  Logger.getLogger(NhanVienCuaGianHangDAOImpl.class);
    public List LayDSNhanVienCuaGianHang(String maGH)
    {
        List ds = null;
        Session session = HibernateUtil.getSessionFactory().openSession();
        try {
            String hql = "select nv.khachhang from Nhanviencuagianhang nv where nv.daXoa=0 and nv.gianhang.maGianHang=:maGH";
            Query query = session.createQuery(hql).setCacheable(true);
            query.setString("maGH", maGH);
            
            ds = query.list();
        } catch (Exception e) {
            logger.error(e.getMessage());
            System.out.println(e.getMessage());
        }
        finally{
            session.close();
        }
        
        return ds;
    }
}
